package com.atqinke.designpattern.behavioraltype.observer;

/**
 * @BelongsProject: BasicConnection
 * @BelongsPackage: com.atqinke.designpattern.behavioraltype.observer
 * @Author: NieHk
 * @CreateTime: 2022-08-29  12:39
 * @Description:
 * @Version: 1.0
 */
public class test {
    public static void main(String[] args) {
        Subject mSubscriptionSubject=new OfficialAccount();
        //创建微信用户
        User user1=new User("孙悟空");
        User user2=new User("猪悟能");
        User user3=new User("沙悟净");
        //订阅公众号
        mSubscriptionSubject.attach(user1);
        mSubscriptionSubject.attach(user2);
        mSubscriptionSubject.attach(user3);
        //公众号更新发出消息给订阅的微信用户
        mSubscriptionSubject.notify("唐僧决定留在女儿国，师徒四人解散了，不去西天取经呢！");
    }
}
